<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<s:iterator value="#request.order.carts">
<div class="border mb20 p10 pb20 shadow" id="rate-product_${id}">
<div class="col-xs-3">
	<a href="detail?id=${product.id}" target="_blank">${product.name}
	<img src="${ALIYUNOSSURL}${product.indexImg}"></a>
</div>
<div class="col-xs-9">
<!-- 2表示已经评论 -->
<s:if test="flag==2">
	<form id="form-${id}">
		<div class="form-group mb5">
			<label class="w">商品评分<div class="fr B2 f12">[已经评论]</div></label>
			<div class="rate-product">
				<s:bean name="org.apache.struts2.util.Counter" id="counter">
								<s:param name="first" value="1" />
								<s:param name="last" value="score" />
								<s:iterator><i class="iconfont B2">&#xe616;</i></s:iterator>
							</s:bean>
							<s:bean name="org.apache.struts2.util.Counter" id="counter">
								<s:param name="first" value="score+1" />
								<s:param name="last" value="5" />
								<s:iterator><i class="iconfont C999">&#xe616;</i></s:iterator>
							</s:bean>
			</div>
		</div>
		<div class="form-group mb5">
		<label>详细评价</label>
		<div class="dashed p10">${comment}</div>
	</div>
	</form>
</s:if>
<s:else>

<form id="form-${id}">
	<div class="form-group mb5">
		<input type="hidden" name="score" id="start_${id}" value="0" />
		<input type="hidden" name="id" value="${id}" />
		<label>商品评分</label>
		<div class="rate-product">
			<i class="iconfont C999 rate-product_${id}" id="start_${id}_1" onclick="rateProdutc(${id},1)">&#xe616;</i>
			<i class="iconfont C999 rate-product_${id}" id="start_${id}_2" onclick="rateProdutc(${id},2)">&#xe616;</i>
			<i class="iconfont C999 rate-product_${id}" id="start_${id}_3" onclick="rateProdutc(${id},3)">&#xe616;</i>
			<i class="iconfont C999 rate-product_${id}" id="start_${id}_4" onclick="rateProdutc(${id},4)">&#xe616;</i>
			<i class="iconfont C999 rate-product_${id}" id="start_${id}_5" onclick="rateProdutc(${id},5)">&#xe616;</i>
		</div>
	</div>
	<div class="form-group mb5">
		<label>详细评</label><div class="fr"><input type="radio" name="anonymous" value="true">匿名评论</div>
		<textarea class="form-control no-resize" id="comment${id}" name="comment" rows="1"
			onkeyup="remainNum('comment${id}','remNum${id}')" onfocus="textareaHeight('comment${id}',4)"></textarea>
		<p class="text-right text-muted f12 fm">
			还可输入<span id="remNum${id}">200</span>字
		</p>
	</div>
	<input type="button" onclick="callAjax('comment','form-${id}',true,'5','PROPUP','rate-product_${id}')" class="btn btn-warning btn-block btn-sm " value="提交评价" />
</form>
</s:else>
</div>
<div class="cb"></div>
</div>
</s:iterator>





<script type="text/javascript">
		function rateProdutc(id,score){
			$(".rate-product_"+id).removeClass("B2");
			$(".rate-product_"+id).addClass("C999");
			for(var i=1;i<=score;i++){
				$("#start_"+id+"_"+i).removeClass("C999");
				$("#start_"+id+"_"+i).addClass("B2");
			}
			$("#start_"+id).val(score);
		}
		
</script>